//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
    StatusBar: app.globalData.StatusBar,
    CustomBar: app.globalData.CustomBar,
    Custom: app.globalData.Custom,
    hasUserInfo: false,
    canIUse: wx.canIUse('button.open-type.getUserInfo'),
    TabCur: 1,
    scrollLeft: 0,
    sign: [{}],
    si:{},
    name:''

  },
  onLoad: function(){
    var that = this
    that.setData({
      name: app.globalData.employee.name
    })
    let signList = [{}]
    wx.request({
      url: 'http://localhost:8081/test/sign',
      method: "POST",
      data: {
        id:app.globalData.employee.id
      },
      success(res){
        signList = res.data.sign
        that.setData({
          sign:signList
        })
      }
    })
  },
  getUserInfo: function (e) {
    console.log(e)
    app.globalData.userInfo = e.detail.userInfo
    this.setData({
      userInfo: e.detail.userInfo,
      hasUserInfo: true
    })
  },
  showModal(e) {
    this.setData({
      modalName: e.currentTarget.dataset.target
    })
  },
  showModal2(e) {
    this.setData({
      modalName: e.currentTarget.dataset.target,
      si: e.currentTarget.dataset.index
    })
  },
  hideModal(e) {
    this.setData({
      modalName: null
    })
  },
  tabSelect(e) {
    console.log(e);
    this.setData({
      TabCur: e.currentTarget.dataset.id,
      scrollLeft: (e.currentTarget.dataset.id - 1) * 60
    })
  }
})
